//
//  BaseTabBarController.m
//  B项目
//
//  Created by 陶志福 on 15/12/16.
//  Copyright © 2015年 tzf. All rights reserved.
//

#import "BaseTabBarController.h"
#import "MainClassViewController.h"
#import "HotCollectionViewController.h"
#import "ClassificationViewController.h"
#import "ChoooseGiftCollectionViewController.h"
@interface BaseTabBarController ()
@property (nonatomic,strong)  UINavigationController *childVC;
@end

@implementation BaseTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.tabBar.tintColor = kThemeColor;
    

    
    self.tabBar.barTintColor = [UIColor whiteColor];
    
    //首页
    MainClassViewController *mainClass = [[MainClassViewController alloc] init];
    mainClass.tabBarItem.image = [UIImage imageNamed:@"bar1.png"];
    // 排行榜
    HotCollectionViewController *topList = [[HotCollectionViewController alloc] initWithCollectionViewLayout:[[UICollectionViewFlowLayout alloc] init]];
    topList.tabBarItem.image = [UIImage imageNamed:@"bar2.png"];
    // 分类
    ClassificationViewController *classFication = [[ClassificationViewController alloc] init];
    classFication.tabBarItem.image = [UIImage imageNamed:@"bar3.png"];
    // 我的
    
    // 选礼
    ChoooseGiftCollectionViewController *chooseGift = [[ChoooseGiftCollectionViewController alloc] initWithCollectionViewLayout:[[UICollectionViewFlowLayout alloc] init]];
    chooseGift.tabBarItem.image = [UIImage imageNamed:@"bar4.png"];
    
    [self addChildViewController:mainClass title:@"礼卿"];
    [self addChildViewController:topList title:@"热门"];
    [self addChildViewController:classFication title:@"分类"];
    [self addChildViewController:chooseGift title:@"选礼"];
    
    // Do any additional setup after loading the view.
}

- (void)addChildViewController:(UIViewController *)childController title:(NSString *)title
{
    _childVC = [[UINavigationController alloc] initWithRootViewController:childController];
    
    _childVC.tabBarItem.title = title;
    
    _childVC.navigationBar.barTintColor = kThemeColor;
    
    [_childVC.navigationBar setTitleTextAttributes:
     
     @{NSFontAttributeName:[UIFont systemFontOfSize:16],
       
       NSForegroundColorAttributeName:[UIColor whiteColor]}];
    
    _childVC.navigationBar.tintColor = [UIColor whiteColor];
    
    
    [self addChildViewController:_childVC];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
